import request from '@/utils/request'

export const findRoleByIds = (roleIds) => {
  console.log(roleIds)
  return request({
    url:'/role/findRoleByIds',
    method:'post',
    data:roleIds,
  }).then(res => {
    return res
  },error => {
    return error
  })
}

export const findRoleById = (roleId) => {
  return request({
    url:'/role/findRoleById',
    method:'get',
    params: {
      roleId
    },
  }).then(res => {
    return res
  },error => {
    return error
  })
}

export const findUnAssignRoleById = (roleIds) => {
  return request({
    url:'/role/findUnAssignRoleById',
    method:'post',
    data:roleIds
  }).then(res => {
    return res
  },error => {
    return error
  })
}


export const findRoleList = (current,size,roleVO) => {
  return request({
    url:'/role/findRoleList',
    method:'post',
    params:{
      current,
      size
    },
    data:roleVO
  }).then(res => {
    return res
  },error => {
    return error
  })
}

export const findMenuAndPermissionByUserId = (roleId) => {
  return request({
    url:'/role-menu/findMenuAndPermissionByUserId',
    method:'get',
    params:{
      roleId
    }
  }).then(res => {
    return res
  },error => {
    return error
  })
}

export const findUserByRoleId = (roleId) => {
  return request({
    url:'/userRole/findUserByRoleId',
    method:'get',
    params:{
      roleId
    }
  }).then(res => {
    return res
  },error => {
    return error
  })
}

export const UpdataRMPUss = (updateRMPUVO) => {
  return request({
    url:'/role-menu/updateRMPU',
    method:'post',
    data:updateRMPUVO
  }).then(res => {
    return res
  },error => {
    return error
  })
}

export const saveRMPUss= (saveRMPUVO) => {
  return request({
    url:'/role-menu/saveRMPUs',
    method:'post',
    data:saveRMPUVO
  }).then(res => {
    return res
  },error => {
    return error
  })
}

export const deleteRoleByRoleId = (roleId) => {
  return request({
    url:'/role/deleteRoleByRoleId',
    method:'get',
    params: {
      roleId
    },
  }).then(res => {
    return res
  },error => {
    return error
  })
}
